	$(function(){
		//打开注册协议
		$(window).resize(function(){
			$(".xieyi").unbind("click").jbox({ para: "id", paracut: "url:get?", adaptive: false, width: 760, height: $(window).height() - 200 });
		}).trigger("resize");	
	});

	//获取验证码
	function getCode(){
		var userName=trim($("#userName").val());
		var loginPassword1=trim($("#loginPassword1").val());
		var loginPassword2=trim($("#loginPassword2").val());
		var mobilePhone = $("#mobilePhone").val();
		var inputCode = $("#inputCode").val();
		//alert(userName);
	/* 	if(!(ckinput(userName,/^(?!\d+$)[\da-zA-Z]{6,12}$/ig))){
			alert("请输入正确的用户名！");
			return;
		} */
		if(!(ckinput(loginPassword1,/^(?!\d+$)[\da-zA-Z]{6,12}$/ig))){
			alert("密码格式输入不正确！");
			return;
		}
		if(loginPassword1 != loginPassword2){
			alert("两次密码输入不一致！");
			return;
		}
		if(!(ckinput(mobilePhone,/^1[0-9]{10}$/ig))){
			alert("请输入正确的手机号码");
			return;
		}
		if(inputCode == ''){
			alert("请输入验证码");
			return;
		}
		$.ajax( {
			type:"post",
			url:"${path}/sms.action",
			data:{
				"mobilePhone" : mobilePhone,
				"inputCode":inputCode
			},
			dataType: "text",
			success : function(result) {
				alert(result);
				if (result=='验证码发送成功！'){
					$(".btns").attr("disabled","disabled").addClass("sel");
					var s = 60;
					$(".btns").val(s + "秒");
					inter = setInterval(function(){
						s--;
						$(".btns").val(s + "秒");
						if(s == 0){
							$(".btns").removeAttr("disabled").removeClass("sel").val("获取验证码");
							clearInterval(inter);
						}
					},1000);
	  			}
				$("#code_img").click();
			}
		});	
	}
	
	//检查输入提交注册
	function user_regist(){
		///var userName=trim($("#userName").val());
		var loginPassword1=trim($("#loginPassword1").val());
		var loginPassword2=trim($("#loginPassword2").val());
		var mobilePhone = trim($("#mobilePhone").val());
		var inputMobileCode = trim($("#inputMobileCode").val());
		var remmendMobilePhone = trim($("#remmendMobilePhone").val());
		

		if(!(ckinput(loginPassword1,/^(?!\d+$)[\da-zA-Z]{6,12}$/ig))){
			alert("密码格式输入不正确！");
			return;
		}
		if(loginPassword1 != loginPassword2){
			alert("两次密码输入不一致！");
			return;
		}
		if(!(ckinput(mobilePhone,/^1[0-9]{10}$/ig))){
			alert("手机号码输入不正确！");
			return;
		} 
		if(remmendMobilePhone !== "" && !(ckinput(remmendMobilePhone,/^1[0-9]{10}$/ig))){
			alert("推荐人手机号码输入不正确！");
			return;
		} 
		if(inputMobileCode == ''){
			alert("验证码不能为空！");
			return;
		}
		ajax({
			url: "${path}/regist.action",
			data: {

	    		"loginPassword1":loginPassword1,
	    		"loginPassword2":loginPassword2,
	    		"mobilePhone":mobilePhone,
	    		"inputMobileCode":inputMobileCode,
	    		"remmendMobilePhone" : remmendMobilePhone
			},
			success: function(data){
				if (data.error == undefined || data.error == '') {
					oDialog.prompt("注册成功");
					window.location.href = "${path}/member/safe.action";
				} else {
					oDialog.prompt(data.error);
					if (data.showCode) {
						refreshCaptcha();
						$(".showcode").show();
					}
					flag = false;
				}
			}
       });
		
	}